<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">

<link rel="stylesheet" type="text/css" href="/Public/css/boot.css">
<link rel="stylesheet" type="text/css" href="/Public/font/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="/Public/css/s.css">
<link rel="stylesheet" type="text/css" href="/Public/css/wap.css">

<div class="hover">
	<div class="text">
		<span>加载中...</span> <i class="fa fa-spinner fa-spin"></i>
	</div>
</div>



<script type="text/javascript" src="/Public/js/jq.js"></script>
<script type="text/javascript" src="/Public/js/jqui.js"></script>
<script type="text/javascript" src="/Public/js/lazyload.js"></script>
<script type="text/javascript" src="/Public/js/boot.js"></script>
<script type="text/javascript" src="/Public/js/function.js"></script>



<!-- 引入 jQuery Mobile 库 -->

    <meta name="description" content="<?php echo ($info["description"]); ?>">
    <meta name="keywords" content="<?php echo ($info["keywords"]); ?>">
    <title><?php echo ($info["title"]); ?>-发帖</title>
    <style type="text/css">
    	.bbc_add_body{
    		width:100%; margin-top:50px;
    	}
        textarea{
        	width:100%; padding:10px 5%; height: 100px; line-height:20px;
        	outline: 0; border:none; resize: none;
        }
        .imglist{
        	background:#fff; margin-top:10px; overflow:auto;
        }
        .imglist .img{
        	width:60px; height:60px; overflow:hidden; float:left; margin:5px;
        }
        .imglist .img img{
        	object-fit: cover; width:60px; height:60px;
        }
        .imglist .img input{
        	width:60px; height:60px;
        }
        
    </style>
</head>
<body>
	<div class="head" style="background-color:#f23030;">
        <div class="left" onclick="back()">
             <i class="fa fa-chevron-left" aria-hidden="true"></i>
        </div>
        <div class="center">
            <p><i class="icon-comments-alt"></i> 发帖</p>
        </div>
        <div class="right">
            <div class="btn btn-default btn-xs" onclick="add()">发布</div>
        </div>
    </div>

    <div class="bbc_add_body">
    	<textarea placeholder="这一刻的想法..."></textarea>

    	<div class="imglist">
    		<div class="img">
    			<img src="/Public/img/add.png" style="position:absolute;height:60px;width:60px;">
    			<input type="file"  name="img" style="position:absolute;z-index: 3;opacity:0;">
    		</div>
    	</div>
    </div>

	<div class="clear"></div>
<div class="foot">
	<a href="<?php echo U('Index/index');?>" data-transition="slide">
		<div class="bttn">
			<div class="img"><i class="fa fa-home" aria-hidden="true"></i></div>
			<div class="text">首页</div>
		</div>
	</a>
	<a href="<?php echo U('Cart/index');?>" data-transition="slide">
		<div class="bttn">
			<div class="img"><i class="fa fa-shopping-cart" aria-hidden="true"></i></div>
			<div class="text">购物车</div>
		</div>
	</a>
	<a href="<?php echo U('Friend/index');?>" data-transition="slide">
		<div class="bttn">
			<div class="img"><i class="fa fa-users" aria-hidden="true"></i></div>
			<div class="text">好友</div>
		</div>
	</a>
	<a href="<?php echo U('Bbc/index');?>" data-transition="slide">
		<div class="bttn">
			<div class="img"><i class="fa fa-comments-o" aria-hidden="true"></i></i></div>
			<div class="text">论坛</div>
		</div>
	</a>
	<a href="<?php echo U('Mine/index');?>" data-transition="slide">
		<div class="bttn">
			<div class="img"><i class="fa fa-user" aria-hidden="true"></i></div>
			<div class="text">我的</div>
		</div>
	</a>
</div>



	<script type="text/javascript" src="/Public/js/lrz.mobile.min.js"></script>
	<script type="text/javascript">
        var input = document.querySelector('input');
        var res;
        var imgnum = 0;

		input.onchange = function () {
			if (imgnum>9) {
				alert('最多上传9张图');
			}else{
				hover_in('正在上传...');
				lrz(this.files[0], {width: 640},function (results) {
					setTimeout('img()',2000);
					res = results;
					imgnum ++;
					console.log(results); 
				});
			}
			


		}

		function img(){
			var html = 
			'<div class="img">'+
				'<img src="'+res.base64+'">'+
			'</div>';
			$('.imglist').append(html);
			hover_out();
		}


		function add(){
			var content = $('textarea').val();
			if (content == "") {
				alert('请说话！');
			}else{
				hover_in('正在上传...');
				setTimeout('succ()',2000);
				
			}
			
		}

		function succ(){
			alert('发布成功');
			location.href="<?php echo U('Bbc/index');?>";
		}

	</script>
</body>
</html>